const app = getApp();
Component({
  //接收 外部传入到属性值
  properties: {
    defaultSetting: {
      type: Object,
      value: {
        title: '默认标题',
        height: 20,
        paddingTop: 0,
        backgroundColor: '#124233',
        size: 'default'
      }
    },
    backHome: {
      type: String,
      value: ''
    },
  },
  // 定义响应式数据
  data: {
    remain: { mins: 0, secs: 0 },
    height: app.globalData.navBarHeight + app.globalData.statusBarHeight +40,
    statusBarHeight: app.globalData.statusBarHeight,
    navBarHeight: app.globalData.navBarHeight,
  },
  lifetimes: {
    attached() {
      console.log(111111)
      setInterval(() => {
        const remain = this.properties.expireTime - Date.now()
        this.setData({
          remain: {
            mins: Math.floor(remain / 60000),
            secs: Math.floor((remain % 60000) / 1000)
          }
        })
      }, 1000)
    }
  },
  // 定义方法
  methods: {
    bindCallBack() {
      console.log('bindCallBack',3233)
      if (this.data.backHome === '1') {
        wx.switchTab({
          url: '/pages/homepage/homepage',
        })
      } else if (this.data.backHome === '2') {
        wx.switchTab({
          url: '/pages/personal/personal',
        })
      } else if (this.data.backHome === '10') {
        wx.switchTab({
          url: '/pages/tasks/tasks',
        })
      } else {
        wx.navigateBack({
          delta: 1,
        });
      }

    }
  }
})